﻿@model List<LAPI.Data.Model.DeportePista>
           
@{
    Int32 numeroRegistros = 0;
    if (Model != null)
    {
        numeroRegistros = Model.Count;
    }
        
    WebGrid grid = null;
    if (numeroRegistros > 0) {
        grid = new WebGrid(Model, rowsPerPage: numeroRegistros);
    } else {
        grid = null;
    }
}

<div class="row">
        @if (grid != null)
        {
            @grid.GetHtml(
            fillEmptyRows: true,
            tableStyle: "table table-striped table-bordered",
            mode: WebGridPagerModes.All,
            footerStyle: "badge",

            columns: grid.Columns(
                grid.Column("idDeportePista", style: "", header: "#", canSort: false),
                grid.Column("pista", style: "", header: "Pista Deportiva", canSort: false),
                grid.Column("deporte", style: "", header: "Deporte/Actividad", canSort: false),
                grid.Column("precio", style: "", header: "Precio (€)", canSort: false),
                grid.Column("suplementoLuz", style: "", header: "Suplemento por luz", canSort: false, format: (item) => item.luz ? item.suplementoLuz : "-"),
                grid.Column("activo", style: "", header: "En activo", canSort: false, format: (item) => item.activo ? "Si" : "No"),
                grid.Column(columnName: "",
                            style: "",
                            header: "Acciones",
                            format:
                                    @<text>                                   
                                        <a class="btn btn-info" rel="tooltip" title="Editar Deporte-Pista" href="@Url.Action(actionName: "Editar", controllerName: "DeportesPista", routeValues: new { id = @item.idDeportePista })">
                                            <i class="icon-edit"></i>                                       
                                        </a>            

                                        @if (!item.activo)
                                        {
                                           <a class="btn btn-success" rel="tooltip" title="Activar Deporte-Pista" href="@Url.Action(actionName: "Activar", controllerName: "DeportesPista", routeValues: new { id = @item.idDeportePista })" onclick="javascript:return confirmacionActivar(this, 'deporte-pista','@Url.Action(controllerName: "DeportesPista", actionName: "Buscar")', {id : @item.idPista } );">
                                                <i class="icon-ok-circle"></i>                                       
                                           </a> 
                                        }
                                        else
                                        {
                                           <a class="btn btn-warning" rel="tooltip" title="Desactivar Deporte-Pista" href="@Url.Action(actionName: "Desactivar", controllerName: "DeportesPista", routeValues: new { id = @item.idDeportePista })" onclick="javascript:return confirmacionDesactivar(this, 'deporte-pista','@Url.Action(controllerName: "DeportesPista", actionName: "Buscar")', {id : @item.idPista } );">
                                                <i class="icon-ban-circle"></i>                                       
                                           </a> 
                                        }
                                                  
                                    </text>,
                            canSort: false)
                        )
                )  
        }
        else
        {
            <div class="span8 offset1 label label-info">               
                No se han encontrado datos...
            </div>
        }
        
</div>
